﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using MINERP.BLL.CustomerManage;
using DevExpress.XtraGrid;
using DevExpress.XtraGrid.Views.Grid;

namespace MINERP.CustomerManage.Controller
{
    public class PhotoInfoController
    {

        #region //private fields

        private PhotoInfoManageBLL          _bll = new PhotoInfoManageBLL();
        private List<PhotoInfoEntity>       _list = null;

        private GridControl                 _grid = null;

            
        #endregion

        #region//public priorities
        /// <summary>
        /// 照片信息显示
        /// </summary>
        internal GridControl Grid
        {
            set
            {
                this._grid = value;
            }
        }

        internal DevExpress.XtraEditors.LabelControl LblPhotoCountC
        {
            get;
            set;
        }

        /// <summary>
        /// 得到照片的数量

        /// </summary>
        internal int PhotoCount
        { 
            get
            {
                if (_list != null)
                {
                    return _list.Count;
                }

                return 0;
            }
        
        }

        #endregion

        #region //public methods
        /// <summary>
        /// 显示刷新数据
        /// </summary>
        /// <param name="sender"></param>
        internal void SetGridData(int id,int orderStatus)
        {
            if (orderStatus == (int)COM.OrderBagStatus.Completed)   //从备份中获取
            {
                this._list = _bll.GetPhotoInfoByOrderInfoID_bk(id);
            }
            else
            {
                this._list = _bll.GetPhotoInfoByOrderInfoID(id);
            }
            this._grid.DataSource = _list;
            this._grid.RefreshDataSource();
            //LblPhotoCountC.Text = _list.Count.ToString();
        }

        #endregion
    }
}
